package com.atguigu.gmall.search.controller;

import com.atguigu.gmall.search.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Arrays;
import java.util.List;

/**
 * @author Jia Fa
 * @create 2021-12-08 17:47
 */
@Controller
public class HelloController {

    @GetMapping("hello")
    public String hello(Model model){

        model.addAttribute("msg","hello Themleaf...");

        List<User> users = Arrays.asList(
                new User(101, 21, "jack", "true"),
                new User(102, 22, "tom", "true"),
                new User(103, 23, "rose", "false"),
                new User(104, 24, "cuicui", "false"),
                new User(105, 25, "fangfang", "false"),
                new User(106, 26, "chunchun", "false")
        );

        model.addAttribute("user", new User(10081,25,"李沉舟","true"));

        model.addAttribute("users", users);

        return "hello";
    }
}
